package yz.dut.edu.graduate.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import yz.dut.edu.graduate.dao.Dish_IngredientMapper;
import yz.dut.edu.graduate.pojo.Dish_Ingredient;

@Service
public class Dish_IngredientService {
    @Autowired
    Dish_IngredientMapper dish_ingredientMapper;

    public int Push(Dish_Ingredient di){
        int id=-1;
        try{
            id=dish_ingredientMapper.insertSelective(di);
        }catch(Exception e){
            e.printStackTrace();
        }
        return id;
    }

    public int DeleteDishIngredient(int d_id){
        int influencedRow ;
        try{
            influencedRow=dish_ingredientMapper.deleteByDId(d_id);
        }catch(Exception e){
            e.printStackTrace();
            influencedRow=0;
        }
        return influencedRow;
    }
}
